
/*

Design Pattern Automation Toolkit.
Application to create applications with emphasis on Design patterns.
And support for round trip engineering.
Copyright (C) 2004 Vineeth Neelakant. nvineeth@gmail.com

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace DotNetReverseEngineering
{
	namespace UIForms
	{
		/// <summary>
		/// Summary description for DotNetReverseEnggForm.
		/// </summary>
		public class DotNetReverseEnggForm : System.Windows.Forms.Form
		{
		private System.Windows.Forms.Button browseButton;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button cancelButton;
		private System.Windows.Forms.Button okButton;
		private System.Windows.Forms.TextBox pathTextBox;
			private string filename;
			/// <summary>
			/// Required designer variable.
			/// </summary>
			private System.ComponentModel.Container components = null;

			public DotNetReverseEnggForm()
			{
				//
				// Required for Windows Form Designer support
				//
				InitializeComponent();

				//
				// TODO: Add any constructor code after InitializeComponent call
				//
			}

			/// <summary>
			/// Clean up any resources being used.
			/// </summary>
			protected override void Dispose( bool disposing )
			{
				if( disposing )
				{
					if(components != null)
					{
						components.Dispose();
					}
				}
				base.Dispose( disposing );
			}

			#region Windows Form Designer generated code
			/// <summary>
			/// Required method for Designer support - do not modify
			/// the contents of this method with the code editor.
			/// </summary>
			private void InitializeComponent() {
			this.pathTextBox = new System.Windows.Forms.TextBox();
			this.okButton = new System.Windows.Forms.Button();
			this.cancelButton = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.browseButton = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// pathTextBox
			// 
			this.pathTextBox.Location = new System.Drawing.Point(32, 80);
			this.pathTextBox.Name = "pathTextBox";
			this.pathTextBox.Size = new System.Drawing.Size(280, 21);
			this.pathTextBox.TabIndex = 3;
			this.pathTextBox.Text = "";
			// 
			// okButton
			// 
			this.okButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.okButton.Location = new System.Drawing.Point(232, 160);
			this.okButton.Name = "okButton";
			this.okButton.TabIndex = 1;
			this.okButton.Text = "&OK";
			this.okButton.Click += new System.EventHandler(this.okButton_Click);
			// 
			// cancelButton
			// 
			this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.cancelButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.cancelButton.Location = new System.Drawing.Point(328, 160);
			this.cancelButton.Name = "cancelButton";
			this.cancelButton.TabIndex = 2;
			this.cancelButton.Text = "&CANCEL";
			this.cancelButton.Click += new System.EventHandler(this.CancelButtonClick);
			// 
			// label1
			// 
			this.label1.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
			this.label1.Location = new System.Drawing.Point(32, 16);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(368, 48);
			this.label1.TabIndex = 0;
			this.label1.Text = "To Support reverse engineering of multiple .NET aware languages, the .NET dll is " +
"taken as input. (for example if you are using C# / VB.NET , To generate a dll , " +
"use the /target:library flag while compiling)";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// browseButton
			// 
			this.browseButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.browseButton.Location = new System.Drawing.Point(328, 80);
			this.browseButton.Name = "browseButton";
			this.browseButton.TabIndex = 4;
			this.browseButton.Text = "&BROWSE";
			this.browseButton.Click += new System.EventHandler(this.browseButton_Click);
			// 
			// DotNetReverseEnggForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
			this.CancelButton = this.cancelButton;
			this.ClientSize = new System.Drawing.Size(418, 206);
			this.Controls.Add(this.browseButton);
			this.Controls.Add(this.pathTextBox);
			this.Controls.Add(this.cancelButton);
			this.Controls.Add(this.okButton);
			this.Controls.Add(this.label1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.Name = "DotNetReverseEnggForm";
			this.Text = ".Net Reverse Engineering";
			this.ResumeLayout(false);
		}
			#endregion

			private void browseButton_Click(object sender, System.EventArgs e)
			{
				OpenFileDialog dialog = new OpenFileDialog();
				dialog.Filter=".NET assemblies(*.dll)|*.dll";
				if ( dialog.ShowDialog()== DialogResult.Cancel)
					return;
				this.pathTextBox.Text = dialog.FileName;
			}

			private void okButton_Click(object sender, System.EventArgs e)
			{
				if( this.pathTextBox.Text==null || pathTextBox.Text.Length==0)
				{
					MessageBox.Show("File name not entered!");
					return;
				}
				this.filename=this.pathTextBox.Text;
				this.DialogResult=DialogResult.OK;
				this.Close();
			}
			public string FileName
			{
				get{ return this.filename;}
			}
			void CancelButtonClick(object sender, System.EventArgs e)
			{
				this.DialogResult=DialogResult.Cancel;
			}
			
		}
	}
}
